<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>highlight_django.html</title>
<meta name="generator" content="KF5::SyntaxHighlighting - Definition (Django HTML Template) - Theme (Breeze Dark)"/>
</head><body style="background-color:#232629;color:#cfcfc2"><pre>
{# Basic extension of a common file #}
<span style="color:#8e44ad;">{% extends</span><span style="color:#8e44ad;"> </span><span style="color:#f44f4f;">&quot;base_file.html&quot;</span><span style="color:#8e44ad;"> </span><span style="color:#8e44ad;">%}</span>

<span style="color:#8e44ad;">{% block</span><span style="color:#8e44ad;"> title </span><span style="color:#8e44ad;">%}</span><span style="color:#8e44ad;">{{ section.title }}</span><span style="color:#8e44ad;">{% endblock %}</span>

<span style="color:#8e44ad;">{% block</span><span style="color:#8e44ad;"> content </span><span style="color:#8e44ad;">%}</span>
<span style="font-weight:bold;">&lt;h1&gt;</span><span style="color:#8e44ad;">{{ section.title }}</span><span style="font-weight:bold;">&lt;/h1&gt;</span>

{# For loop example #}

<span style="color:#8e44ad;">{% for</span><span style="color:#8e44ad;"> item in item_list </span><span style="color:#8e44ad;">%}</span>
<span style="font-weight:bold;">&lt;h2&gt;</span>
  <span style="font-weight:bold;">&lt;a</span><span style="color:#27ae60;"> href=</span><span style="color:#f44f4f;">&quot;</span><span style="color:#8e44ad;">{{ item.get_absolute_url }}</span><span style="color:#f44f4f;">&quot;</span><span style="font-weight:bold;">&gt;</span>
    <span style="color:#8e44ad;">{{ item.text }}</span>
    <span style="color:#8e44ad;">{{ item.other_text</span><span style="color:#27ae60;">|upper </span><span style="color:#8e44ad;">}}</span>
  <span style="font-weight:bold;">&lt;/a&gt;</span>
<span style="font-weight:bold;">&lt;/h2&gt;</span>
<span style="font-weight:bold;">&lt;p&gt;</span><span style="color:#8e44ad;">{{ story.longer_text</span><span style="color:#27ae60;">|truncatewords:</span><span style="color:#f44f4f;">&quot;100&quot;</span><span style="color:#27ae60;"> </span><span style="color:#8e44ad;">}}</span><span style="font-weight:bold;">&lt;/p&gt;</span>
<span style="color:#8e44ad;">{% endfor %}</span>
<span style="color:#8e44ad;">{% endblock %}</span>


{# For loop example with specific content if empty #}

<span style="color:#8e44ad;">{% for</span><span style="color:#8e44ad;"> item in other_list </span><span style="color:#8e44ad;">%}</span>
<span style="font-weight:bold;">&lt;h2&gt;</span>
	<span style="color:#8e44ad;">{{ item.text }}</span>
<span style="font-weight:bold;">&lt;/h2&gt;</span>
<span style="color:#8e44ad;">{% else</span><span style="color:#8e44ad;"> </span><span style="color:#8e44ad;">%}</span>
<span style="font-weight:bold;">&lt;h2&gt;</span>
	This list is empty
<span style="font-weight:bold;">&lt;/h2&gt;</span>
<span style="color:#8e44ad;">{% endfor %}</span>
<span style="color:#da4453;text-decoration:underline;">{% endblock %}</span>


{# if example #}

<span style="color:#8e44ad;">{% if</span><span style="color:#8e44ad;"> item_list </span><span style="color:#8e44ad;">%}</span>
    Number of items: <span style="color:#8e44ad;">{{ item_list</span><span style="color:#27ae60;">|length </span><span style="color:#8e44ad;">}}</span>
<span style="color:#8e44ad;">{% elif</span><span style="color:#8e44ad;"> some_condition </span><span style="color:#8e44ad;">%}</span>
    Show this text
<span style="color:#8e44ad;">{% else</span><span style="color:#8e44ad;"> </span><span style="color:#8e44ad;">%}</span>
    Nothing to process
<span style="color:#8e44ad;">{% endif %}</span>

{# This is a comment #} hello comment


{# Translation example #}

<span style="color:#8e44ad;">{% translate</span><span style="color:#8e44ad;"> </span><span style="color:#f44f4f;">&quot;Title&quot;</span><span style="color:#8e44ad;"> as title </span><span style="color:#8e44ad;">%}</span>
<span style="color:#8e44ad;">{% block</span><span style="color:#8e44ad;"> content </span><span style="color:#8e44ad;">%}</span><span style="color:#8e44ad;">{{ title }}</span><span style="color:#8e44ad;">{% endblock %}</span>


{# Auto-escaping #}

<span style="color:#8e44ad;">{% autoescape</span><span style="color:#8e44ad;"> off </span><span style="color:#8e44ad;">%}</span>
    Hello <span style="color:#8e44ad;">{{ name }}</span>
<span style="color:#8e44ad;">{% endautoescape %}</span>


{# Loading custom tags/libraries #}

<span style="color:#8e44ad;">{% load</span><span style="color:#8e44ad;"> humanize </span><span style="color:#8e44ad;">%}</span>
</pre></body></html>
